package com.jdk.demo.queue.arrayBlockingQueue;

import java.util.Iterator;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

public class MainClass {

	public static void main(String[] args) throws InterruptedException {
		BlockingQueue<String> blockingQueue = new ArrayBlockingQueue<>(3, true);
		Producer producerPut = new Producer(blockingQueue);
		Consumer consumer = new Consumer(blockingQueue);
		new Thread(producerPut).start();
		Thread.sleep(100);
		Iterator<String> it = blockingQueue.iterator();
		Iterator<String> it2 = blockingQueue.iterator();
		while(it.hasNext()){
			System.out.println(it.next());
		}

		new Thread(consumer).start();
		Thread.sleep(1000);
	}

}
